<script type="text/javascript" src="<?php echo base_url(); ?>static/select2/select2.min.js" ></script>
<script type="text/javascript" src="<?php echo base_url(); ?>static/js/selectSearchGlobal.js"></script>
<!--
<link type="text/css" href="<?php echo base_url(); ?>ajaxupload/ajaxfileupload.css" rel="stylesheet" /> 
<script src="<?php echo base_url(); ?>ajaxupload/jquery.js" type="text/javascript"></script>
<script src="<?php echo base_url(); ?>ajaxupload/ajaxfileupload.js" type="text/javascript"></script>
-->

<script>
function appManagerSave() {
        $.post("<?= site_url() ?>search_global/app_mgrSrnKrjReqSave", {
            pCtrlID: $('#pCtrlID').val(),
            pApproval: $('#pApproval').val(),
            pNikRequestBy: $('#pNikRequestBy').val(),
            //pComment: $('#pComment').val(),
            //pAccesNo: $('#pAccesNo').val()
        },
        function(data) {
            window.location = '<?php echo base_url(); ?>search_global';
        }
        );
    }
function cancel(){
    window.location = '<?php echo base_url(); ?>search_global';
}
</script>

<?php 
	foreach($getDetail as $h){
        $hId   			= $h["REQ_ID"];
    	$hDate   		= $h["REQ_DATE"];
    	$hDescription   = $h["REQ_DESCRIPTION"];
    	$hNik   		= $h["REQ_NIK"];
    	$hUntukNik   	= $h["REQ_UNTUK_NIK"];
    	$hAtasankNik   	= $h["REQ_ATASAN_NIK"];
    	$pReqInfoHrd   	= $h["REQ_INFO_HRD"];
    	$hReqFloor      = $h["REQ_FLOOR"];
    	$hReqRbfId      = $h["REQ_RBF_ID"];
    	$hAtasankName	= $h["ATASANNAME"];
    	
    	$xName 			= $h["NIKNAME"];
    	$xOrg  			= $h["NIKORG"];
    	$xJob  			= $h["NIKJOBPOSITION"];
 	}
    if(empty($cRequestNo) && !empty($pReqForNik)){
    	$cNik				= $pReqForNik;
    	$cName  			= $this->sGlobal_model->getName($pReqForNik);
    	$cOrg  				= $this->sGlobal_model->getOrg($pReqForNik);
    	$cJob  				= $this->sGlobal_model->getJobPosition($pReqForNik);
    }else{
    	$cNik				= $hUntukNik ;
    	$cName  			= $this->sGlobal_model->getName($hUntukNik);
    	$cOrg  				= $this->sGlobal_model->getOrg($hUntukNik);
    	$cJob  				= $this->sGlobal_model->getJobPosition($hUntukNik);
    	$cJob2 				= $this->sGlobal_model->getJob($hUntukNik);
    }
?>

<div id="top" >
<form id="formarea" role="form" method="post" action="" class="form-horizontal"  enctype="multipart/form-data"> 
    <input type="hidden" value="<?php echo $cRequestNo; ?>" id="pCtrlID" name="pCtrlID" />
    <input type="hidden" value="<?php echo $cType; ?>" id="pCType" name="pCType"/>
    <input type="hidden" value="<?php echo $sesNik;?>" id="pNik" name="pNik"/>
    <input type="hidden" value="<?php echo $hNik;?>" id="pNikRequestBy" name="pNikRequestBy"/>


    <div class="col-md-offset-0">
		<div class="col-md-11">
			<div class="panel panel-default">
				<div class="panel-heading"><h4 class="panel-title"><b class="caret"></b><b> Request By</b></h4></div>
				<div class="panel-body">
					<div class="col-xs-12 col-md-6">
						<div class="form-group">
							<label class="control-label col-md-3">Nama </label>
							<div class="col-md-7">
                                <input type="text" value="<?php echo $xName;?>" id="r_nama" class="select2 form-control input-sm" readonly=""/>
                                <!--<input type="text" value="<?php echo $xName;?>" id="r_name" class="select2 form-control input-sm"/>-->
                            </div>
						</div>					
						<div class="form-group">
							<label class="control-label col-md-3">Nik</label>
							<div class="col-md-3">
                                <input type="text" value="<?php echo $hNik;?>" id="r_id" class="form-control input-sm" readonly=""/>
                            </div>
						</div><!--
						<div class="form-group">
							<label class="control-label col-md-3">Nama Atasan</label>
							<div class="col-md-7">
                                <input type="hidden" value="<?php echo $hAtasankNik;?>" id="r_mgrid" class="form-control input-sm" readonly=""/>
                                <input type="text" value="<?php echo $hAtasankName;?>" id="r_mgr" class="form-control input-sm" readonly=""/>
                            </div>
						</div>-->
					</div>
					<div class="col-sm-7 col-md-6">
						<div class="form-group">
							<label class="control-label col-md-4">Departement</label>
							<div class="col-md-7">
                                <input type="text" value="<?php echo $xOrg;?>" id="r_dept" class="form-control input-sm" readonly=""/>
                            </div>
						</div>
						<div class="form-group">
							<label class="control-label col-md-4">Job Position</label>
							<div class="col-md-8">
                                <input type="text" value="<?php echo $xJob;?>" id="r_job" class="form-control input-sm" readonly=""/>
                            </div>
						</div>
					</div>
				</div>
			</div>
            <div class="panel panel-default">
				<div class="panel-heading"><h4 class="panel-title"><b class="caret"></b><b> Requestor</b></h4></div>
				<div class="panel-body">
					<div class="col-xs-12 col-md-6">
						<div class="form-group">
							<label class="control-label col-md-3">Nama </label>
							<div class="col-md-7">
                                <input type="text" value="<?php echo $cName;?>" id="r_nama" class="select2 form-control input-sm" readonly=""/>
                                <!--<input type="text" value="<?php echo $cName;?>" id="r_name" class="select2 form-control input-sm"/>-->
                            </div>
						</div>					
						<div class="form-group">
							<label class="control-label col-md-3">Nik</label>
							<div class="col-md-3">
                                <input type="text" value="<?php echo $cNik;?>" id="r_id" class="form-control input-sm" readonly=""/>
                            </div>
						</div>
					</div>
					<div class="col-sm-7 col-md-6">
						<div class="form-group">
							<label class="control-label col-md-4">Departement</label>
							<div class="col-md-7">
                                <input type="text" value="<?php echo $cOrg;?>" id="r_dept" class="form-control input-sm" readonly=""/>
                            </div>
						</div>
						<div class="form-group">
							<label class="control-label col-md-4">Job Position</label>
							<div class="col-md-8">
                                <input type="text" value="<?php echo $cJob;?>" id="r_job" class="form-control input-sm" readonly=""/>
                            </div>
						</div>
					</div>
				</div>
			</div>
			<div class="panel panel-default">
				<div class="panel-heading">
					<h4 class="panel-title"><b class="caret"></b><b> Form</b></h4>
				</div>
				<div class="panel-body">
					<div class="col-sm-7 col-md-6">
						<div class="form-group">
							<label class="control-label col-md-3">Description</label>
                            <div class="col-md-7">
                                <textarea id="pReqDescription" class="form-control input-sm" cols="50" rows="3" readonly=""><?php echo $hDescription; ?></textarea>
                            </div>
						</div>
					</div>
					<div class="col-sm-7 col-md-6">
						<div class="form-group">
							<label class="control-label col-md-4">Informasi HRD</label>
							<div class="col-md-7">
                                <textarea id="pReqInfoHrd" class="form-control input-sm" cols="50" rows="3" readonly=""><?php echo $hInfoHrd;?></textarea>
                            </div>
						</div>						
					</div>
                    
                    <div class="col-sm-7 col-md-6">
						<div class="form-group">
							<label class="control-label col-md-4"></label>
							<div class="col-md-7">
                            </div>
						</div>						
					</div>
                    <div class="col-sm-7 col-md-6">
                            <div class="form-group">
                                <label class="control-label col-md-4">Approval</label>
        						<div class="col-md-7">
                                    <select class="form-control input-form select2" id="pApproval" style="width:100%">
                            			<option value="Y">Approve</option>
                                        <option value="N" selected="">Disapprove</option>
    				                </select>
        						</div>
    				        </div>
                    </div>  
                    
                    <div class="row"> 
                        <div class="col-sm-12">
                            <div class="form-group">
                                <label class="control-label col-md-3"></label>
        						<div class="col-sm-2">
                                    <button type="button" class="btn btn-primary btn-block" onclick="appManagerSave();">Submit</button>
                                </div>
                                <div class="col-sm-2">
                                    <button type="button" class="btn btn-default btn-block" onclick="cancel();" >Cancel</button>
                                </div>
    				        </div>
                        </div>                   
                    </div>
				</div>
			</div>
		</div>
	</div>

</form>
</div>